package net.lcheng.service.impl;

import net.lcheng.dao.WxShopBannerMapper;
import net.lcheng.model.PProduct;
import net.lcheng.model.WxShopBanner;
import net.lcheng.model.WxShopBannerExample;
import net.lcheng.service.WxShopBannerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zwr on 2016/7/4 0004.
 */
@Service
public class WxShopBannerServiceImpl implements WxShopBannerService {
    @Resource
    private WxShopBannerMapper mapper;
    @Override
    public WxShopBanner getBannerByBannerId(String wxShopShopId) {
        return mapper.selectByPrimaryKey(wxShopShopId);
    }

    @Override
    public List<WxShopBanner> getBannerListByShopId(Integer wxShopShopId) {
//        WxShopBannerExample example=new WxShopBannerExample();
//        example.or().andWxShopShopIdEqualTo(wxShopShopId).andStatusEqualTo(1);
         List<WxShopBanner> list = mapper.getBannerListByShopId(wxShopShopId);
        return list;
    }
    @Override
    public int addBanner(WxShopBanner wxShopBanner) {
        return mapper.insert(wxShopBanner);
    }

    @Override
    public int edit(WxShopBanner wxShopBanner) {
        return mapper.updateByPrimaryKeySelective(wxShopBanner);
    }

    @Override
    public int modifyStatus(WxShopBanner wxShopBanner) {
        return mapper.updateByPrimaryKeySelective(wxShopBanner);
    }
}
